<%-- 
    Document   : manageBill
    Created on : Sep 19, 2013, 1:36:33 PM
    Author     : Tan Le Anh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:include page="header.jsp"/>
<script>
  function confirmDelete() {
    if (confirm("Bạn có muốn xóa không？")) {
      return true;
    } else {
      return false;
    }
  }
</script>
<div id="wrapper-page">
  <div class="function-wrap">
    <h2>Quản lý đơn hàng</h2>
    <a href="menuFunction.jsp" style="display:block;width:50px;" ><div class="btnbackMenu"></div></a>
    <div class="listProduct">
      <h3>Danh sách đơn hàng</h3>
      <div class="search">
        <form action="C_DonHang">
          <input style="padding-left:10px;width:200px; height:30px;" type="text" name="txtSearch" placeholder="Tên tài khoản?"/>
          <input type="hidden" name="btAction" value="SearchBill" />
        </form>
      </div>
      <div class="list">
        <c:set var="info" value="${requestScope.INFO}"/>
        <c:if test="${not empty info}">
          <table style="width: 950px; border: 1px solid #dedede;">
            <tbody>
              <tr>
                <td>STT</td>
                <td>Tài khoản</td>
                <td>Ngày tạo</td>
                <td>Tổng sản phẩm</td> 
                <td>Tổng tiền</td>
                <td>Chi tiết</td>
              </tr>
              <c:set var="count" value="0"/>
              <c:forEach var="rows" items="${info}">
                <c:set var="count" value="${count+1}"/>
                <tr>
                  <td>${count}</td>
                  <td>${rows[1]}</td>
                  <td>${rows[2]}</td>
                  <td>${rows[3]}</td> 
                  <td>${rows[4]}</td>

                  <c:url var="details" value="C_DonHang">
                    <c:param name="btAction" value="DetailsBill"/>
                    <c:param name="mahd" value="${rows[0]}"/>
                    <c:param name="txtSearch" value="${param.txtSearch}"/>
                  </c:url>
                  <td>
                    <a href="${details}">
                      <img src="./skin/images/details.png" width="20" style="float:left;"/>
                    </a>
                  </td>
                </tr>        
              </c:forEach>
            </tbody>
          </table>
        </c:if>
      </div>
    </div>  
    <c:set var="dt" value="${requestScope.DETAILS}"/>
    <c:if test="${not empty dt}">                  
      <div class="listProduct">
        <div class="head">
          <h2>Chi tiết đơn hàng</h2>
        </div>
        <div class="sect">
          <c:forEach var="rows" items="${dt}">
            <div class="myorder">
              <c:choose>
                <c:when test="${not empty rows[7]}">
                  <img class="img-polaroid" src="skin/images/sp/${rows[7]}"/>
                </c:when>
                <c:otherwise>
                  <img class="img-polaroid" src="./skin/images/noimage.png">
                </c:otherwise>
              </c:choose>
              <div class="order_pro">
                <h3>${rows[6]}</h3>
                <div class="order_l">
                  <span class="pro_l">Mã đơn hàng</span>
                  <span class="pro_r" style="font-weight:bold;">${rows[0]}</span>
                  <div style="clear:both;"></div>
                  <div style="clear:both;"></div>
                  <span class="pro_l">Người mua:</span>
                  <span class="pro_r">
                    <span class="pro_r" style="font-weight:bold;">${rows[1]}</span>
                  </span>
                </div>
                <div class="order_r">
                  <div style="clear:both;"></div>
                  <span class="pro_l">Số lượng</span>
                  <span class="pro_r"><b style="font-size:14px; color:#00F;">${rows[4]}</b></span>
                  <div style="clear:both;"></div>

                  <div style="clear:both;"></div>
                  <span class="pro_l">Tiền phải trả</span>
                  <span class="pro_r"><b>${rows[5]}</b> đồng</span>
                </div>
              </div>
            </div>
            <div style="clear:both;"></div>
          </c:forEach>
          <div style="clear:both;"></div>
        </div>
      </div>   
    </c:if>
  </div> 
</body>
</html>
